package com.suray.wcs.service.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.suray.basic.wcs.utils.IBaseEnum;

import java.io.Serializable;

/**
 * @author caox
 */

public enum RoadDirection implements IBaseEnum<Serializable> {
    X("X", "X轴方向"),
    Y("Y", "Y轴方向");

    @EnumValue
    private String code;
    @JsonValue
    private String description;

    RoadDirection(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public static RoadDirection getByCode(String code) {
        RoadDirection[] singleRuleDirectionEnums = RoadDirection.values();
        for (RoadDirection item : singleRuleDirectionEnums) {
            if (item.code.equals(code)) {
                return item;
            }
        }
        return null;
    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public Serializable getVal() {
        return code;
    }

    @Override
    public Serializable getValue() {
        return code;
    }
}
